#FILE NAME: 6711SingleSeedinWater.txt
#MC CODE: TOPAS V3.8 
#DESCRIPTION: Test case 1 – single 6711 seed centered at origin and aligned with y-axis in water phantom; see [reference]
#DISCLAIMER: This file (and associated code/files) is provided in the hope that it will be useful
#but without any warranty; without even the implied warranty of fitness for a particular
#purpose. See full disclaimer at [link]
#COPYRIGHT (C) 2023 Luc Beaulieu (Luc.Beaulieu@phy.ulaval.ca) and Audran Poher
#REDISTRIBUTION: redistribution of this and all associated files is NOT permitted.
#SOURCE OF THIS FILE: [link]

b:Ma/MyWater/BuildFromMaterials = "True"
sv:Ma/MyWater/Components = 1 "G4_WATER"
uv:Ma/MyWater/Fractions = 1 1
d:Ma/MyWater/Density = 0.998 g/cm3    

##### WORLD #####
d:Ge/World/HLX = 15 cm
d:Ge/World/HLY = 15 cm
d:Ge/World/HLZ = 15 cm
s:Ge/World/Material = "MyWater"

# ====================================================== #
#                         PHYSICS                        #
# ====================================================== #

sv:Ph/Default/Modules                  = 1 "g4em-livermore"
d:Ph/Default/CutForElectron            = 1 mm
b:Ph/Default/Auger                     = "T"
b:Ph/Default/AugerCascade              = "T"
b:Ph/Default/Fluorescence              = "T"
b:Ph/Default/DeexcitationIgnoreCut     = "T"    
    
i:Ts/Seed            = 1#{SEED}
i:Ts/NumberOfThreads = 0


# ====================================================== #
#                         SCORER                         #
# ====================================================== #

##### RADIAL FUNCTION SCORER #####
s:Ge/RTDoseGrid/Type       = "TsBox"
s:Ge/RTDoseGrid/Parent     = "World"
d:Ge/RTDoseGrid/HLX        =  12.75 mm
d:Ge/RTDoseGrid/HLY        =  12.75 mm
d:Ge/RTDoseGrid/HLZ        =  12.75 mm
d:Ge/RTDoseGrid/TransX     =  0 mm
d:Ge/RTDoseGrid/TransY     =  0 mm
d:Ge/RTDoseGrid/TransZ     =  12 mm
s:Ge/RTDoseGrid/Color      =  "red"
b:Ge/RTDoseGrid/IsParallel = "T"
i:Ge/RTDoseGrid/XBins      = 51
i:Ge/RTDoseGrid/YBins      = 51
i:Ge/RTDoseGrid/ZBins      = 51

#d:Sc/ScorerCyl/OnlyIncludeParticlesWithInitialKEAbove = 5. keV
s:Sc/ScorerCyl/Quantity   = "TrackLengthEstimator"
s:Sc/ScorerCyl/InputFile  = "Muen.dat"

#s:Sc/ScorerCyl/Quantity   = "DoseToMedium"
sv:Sc/ScorerCyl/Report    = 1 "Sum" 
s:Sc/ScorerCyl/Component  = "RTDoseGrid"
s:Sc/ScorerCyl/OutputFile = "6711_SingleSeedWater_DoseDistribution_parallel_{1}"
s:Sc/ScorerCyl/OutputType                 = "DICOM"
b:Sc/ScorerCyl/DICOMOutput32BitsPerPixel  = "True"
s:Sc/ScorerCyl/IfOutputFileAlreadyExists = "Increment"
sv:Sc/ScorerCyl/OnlyIncludeParticlesNamed = 1 "gamma"
sv:Sc/ScorerCyl/OnlyIncludeIfInMaterial = 1 "MyWater"
#sv:Sc/ScorerCyl/OnlyIncludeIfNotInMaterial = 4 "MatRadioMatrix" "G4_Ag" "Titanium" "G4_AIR" 

#d:Sc/ScorerCyl1/OnlyIncludeParticlesWithInitialKEAbove = 5. keV
s:Sc/ScorerCyl1/Quantity   = "TrackLengthEstimator"
s:Sc/ScorerCyl1/InputFile  = "Muen.dat"

#s:Sc/ScorerCyl1/Quantity   = "DoseToMedium"
sv:Sc/ScorerCyl1/Report    = 1 "Standard_Deviation" 
s:Sc/ScorerCyl1/Component  = "RTDoseGrid"
s:Sc/ScorerCyl1/OutputFile = "6711_SingleSeedWater_Std_DoseDistribution_parallel_{1}"
s:Sc/ScorerCyl1/OutputType = "csv"
s:Sc/ScorerCyl1/IfOutputFileAlreadyExists = "Increment"
sv:Sc/ScorerCyl1/OnlyIncludeParticlesNamed = 1 "gamma"
sv:Sc/ScorerCyl1/OnlyIncludeIfInMaterial = 1 "MyWater"


# ====================================================== #
#                         VIEWER                         #
# ====================================================== #

#Ge/QuitIfOverlapDetected     = "F"
s:Gr/ViewA/Type              = "OpenGL"
#i:Gr/ViewA/WindowSizeX      = 1024
#i:Gr/ViewA/WindowSizeY      = 768
d:Gr/ViewA/Theta             = 90. deg
d:Gr/ViewA/Phi               = 0. deg
#s:Gr/ViewA/Projection       = "Perspective"
#d:Gr/ViewA/PerspectiveAngle = 30. deg
u:Gr/ViewA/Zoom              = 1
b:Gr/MyGraphic1/IncludeAxes = "True" # defaults to "False"
s:Gr/ViewA/CenterOn = "World"
b:Ts/UseQt = "F"
b:Gr/Enable           = "F"
b:Ts/PauseBeforeQuit  = "F"    
    
# ====================================================== #
#                I 125 - OncoSeed 6711                   #
# ====================================================== #

##### MATERIALS ######
sv:Ma/MatRadioMatrix/Components = 3 "Silver" "Iodine" "Bromine"
uv:Ma/MatRadioMatrix/Fractions = 3 0.5416 0.30396 0.15444
d:Ma/MatRadioMatrix/Density    = 6.2 g/cm3

s:Ge/GroupOfSeeds/Type              = "Group"
s:Ge/GroupOfSeeds/Parent            = "World"
d:Ge/GroupOfSeeds/TransX            = 0 mm
d:Ge/GroupOfSeeds/TransY            = 0 mm
d:Ge/GroupOfSeeds/TransZ            = 0 mm

sv:Ph/Default/LayeredMassGeometryWorlds = 2 "ShieldingWorld" "ActiveSourceWorld"

ic:So/ActiveSource0/NumberOfHistoriesInRun    = 1000000000   

s:Ge/Seed0/Type              = "Group"
s:Ge/Seed0/Parent            = "GroupOfSeeds"
d:Ge/Seed0/TransX            = 0 mm
d:Ge/Seed0/TransY            = 0 mm
d:Ge/Seed0/TransZ            = 0 mm
d:Ge/Seed0/RotX              = 90 deg
d:Ge/Seed0/RotY              = 0 deg
d:Ge/Seed0/RotZ              = 0 deg

##### SOURCE GEOMETRY #####

s:Ge/ActiveSourceGeometry0/Type              = "Group"
s:Ge/ActiveSourceGeometry0/Parent            = "Seed0"
b:Ge/ActiveSourceGeometry0/IsParallel        = "True"
s:Ge/ActiveSourceGeometry0/ParallelWorldName = "ActiveSourceWorld"


##### SOURCE #####
s:So/ActiveSource0/Type                       = "Volumetric"
s:So/ActiveSource0/Component                 = "ActiveSourceGeometry0"
sc:So/ActiveSource0/ActiveMaterial            = "MatRadioMatrix"
s:So/ActiveSource0/BeamParticle               = "gamma"
b:So/ActiveSource0/RecursivelyIncludeChildren = "T"
i:So:ActiveSource0/MaxNumberOfPointsToSample = 1000000000
s:So/ActiveSource0/BeamEnergySpectrumType     = "Discrete"

###### SPECTRUM ######
dv:So/ActiveSource0/BeamEnergySpectrumValues = 6 27.202 27.472 30.944 30.995 31.704 35.4925 keV
uv:So/ActiveSource0/BeamEnergySpectrumWeightsUnscaled = 6 0.396 0.731 0.0674 0.130 0.0375 0.0668
uv:So/ActiveSource0/BeamEnergySpectrumWeights = 0.699937006 * So/ActiveSource0/BeamEnergySpectrumWeightsUnscaled


#====================
#Radioactive cylinder
#====================

s:Ge/RadioactiveCylinder0/Type         = "TsCylinder"
s:Ge/RadioactiveCylinder0/Parent       = "ActiveSourceGeometry0"
s:Ge/RadioactiveCylinder0/Material     = "MatRadioMatrix"
d:Ge/RadioactiveCylinder0/RMin         = 0.25 mm
d:Ge/RadioactiveCylinder0/RMax         = 0.25175 mm
d:Ge/RadioactiveCylinder0/SPhi         = 0. deg
d:Ge/RadioactiveCylinder0/DPhi         = 360. deg
d:Ge/RadioactiveCylinder0/HL           = 1.325 mm
d:Ge/RadioactiveCylinder0/TransX       = 0. mm
d:Ge/RadioactiveCylinder0/TransY       = 0. mm
d:Ge/RadioactiveCylinder0/TransZ       = 0. mm
d:Ge/RadioactiveCylinder0/RotX         = 0. deg
d:Ge/RadioactiveCylinder0/RotY         = 0. deg
d:Ge/RadioactiveCylinder0/RotZ         = 0. deg
s:Ge/RadioactiveCylinder0/DrawingStyle = "FullWireFrame"
s:Ge/RadioactiveCylinder0/Color        = "yellow"
b:Ge/RadioactiveCylinder0/IsParallel   = "T"
s:Ge/RadioactiveCylinder0/ParallelWorldName = "ActiveSourceWorld"

#=====================
#Radioactive left end
#=====================
s:Ge/RadioactiveLeftEnd0/Type                   = "G4Cons"
s:Ge/RadioactiveLeftEnd0/Parent                 = "ActiveSourceGeometry0"
s:Ge/RadioactiveLeftEnd0/Material               = "MatRadioMatrix"
d:Ge/RadioactiveLeftEnd0/TransX                 = 0 mm
d:Ge/RadioactiveLeftEnd0/TransY                 = 0 mm
d:Ge/RadioactiveLeftEnd0/TransZ                 = 1.363375 mm
d:Ge/RadioactiveLeftEnd0/RotX                   = 0 deg
d:Ge/RadioactiveLeftEnd0/RotY                   = 0 deg
d:Ge/RadioactiveLeftEnd0/RotZ                   = 0 deg
d:Ge/RadioactiveLeftEnd0/RMin1                  = 0. mm
d:Ge/RadioactiveLeftEnd0/RMax1                  = 0.25175 mm
d:Ge/RadioactiveLeftEnd0/RMin2                  = 0. mm
d:Ge/RadioactiveLeftEnd0/RMax2                  = 0.17675 mm
d:Ge/RadioactiveLeftEnd0/HL                     = 0.038375 mm
d:Ge/RadioactiveLeftEnd0/SPhi                   = 0 deg
d:Ge/RadioactiveLeftEnd0/DPhi                   = 360 deg
s:Ge/RadioactiveLeftEnd0/Color                  = "yellow"
s:Ge/RadioactiveLeftEnd0/DrawingStyle           = "FullWireFrame"
b:Ge/RadioactiveLeftEnd0/IsParallel             = "T"
s:Ge/RadioactiveLeftEnd0/ParallelWorldName      = "ActiveSourceWorld"

#=====================
#Radioactive right end
#=====================
s:Ge/RadioactiveRightEnd0/Type                   = "G4Cons"
s:Ge/RadioactiveRightEnd0/Parent                 = "ActiveSourceGeometry0"
s:Ge/RadioactiveRightEnd0/Material               = "MatRadioMatrix"
d:Ge/RadioactiveRightEnd0/TransX                 = 0 mm
d:Ge/RadioactiveRightEnd0/TransY                 = 0 mm
d:Ge/RadioactiveRightEnd0/TransZ                 = -1.363375 mm
d:Ge/RadioactiveRightEnd0/RotX                   = 0 deg
d:Ge/RadioactiveRightEnd0/RotY                   = 180 deg
d:Ge/RadioactiveRightEnd0/RotZ                   = 0 deg
d:Ge/RadioactiveRightEnd0/RMin1                  = 0. mm
d:Ge/RadioactiveRightEnd0/RMax1                  = 0.25175 mm
d:Ge/RadioactiveRightEnd0/RMin2                  = 0. mm
d:Ge/RadioactiveRightEnd0/RMax2                  = 0.17675 mm
d:Ge/RadioactiveRightEnd0/HL                     = 0.038375 mm
d:Ge/RadioactiveRightEnd0/SPhi                   = 0 deg
d:Ge/RadioactiveRightEnd0/DPhi                   = 360 deg
s:Ge/RadioactiveRightEnd0/Color                  = "yellow"
s:Ge/RadioactiveRightEnd0/DrawingStyle           = "FullWireFrame"
b:Ge/RadioactiveRightEnd0/IsParallel             = "T"
s:Ge/RadioactiveRightEnd0/ParallelWorldName      = "ActiveSourceWorld"

#====================
#Silver cylinder
#====================

s:Ge/SilverCylinder0/Type         = "TsCylinder"
s:Ge/SilverCylinder0/Parent       = "ActiveSourceGeometry0"
s:Ge/SilverCylinder0/Material     = "G4_Ag"
d:Ge/SilverCylinder0/RMin         = 0. mm
d:Ge/SilverCylinder0/RMax         = 0.25 mm
d:Ge/SilverCylinder0/SPhi         = 0. deg
d:Ge/SilverCylinder0/DPhi         = 360. deg
d:Ge/SilverCylinder0/HL           = 1.325 mm
d:Ge/SilverCylinder0/TransX       = 0. mm
d:Ge/SilverCylinder0/TransY       = 0. mm
d:Ge/SilverCylinder0/TransZ       = 0. mm
d:Ge/SilverCylinder0/RotX         = 0. deg
d:Ge/SilverCylinder0/RotY         = 0. deg
d:Ge/SilverCylinder0/RotZ         = 0. deg
s:Ge/SilverCylinder0/DrawingStyle = "FullWireFrame"
s:Ge/SilverCylinder0/Color        = "grey"
b:Ge/SilverCylinder0/IsParallel   = "T"
s:Ge/SilverCylinder0/ParallelWorldName = "ActiveSourceWorld"

#=================
#Silver left end
#=================

s:Ge/SilverLeftEnd0/Type                   = "G4Cons"
s:Ge/SilverLeftEnd0/Parent                 = "RadioactiveLeftEnd0"
s:Ge/SilverLeftEnd0/Material               = "G4_Ag"
d:Ge/SilverLeftEnd0/TransX                 = 0 mm
d:Ge/SilverLeftEnd0/TransY                 = 0 mm
d:Ge/SilverLeftEnd0/TransZ                 = -0.000875 mm
d:Ge/SilverLeftEnd0/RotX                   = 0 deg
d:Ge/SilverLeftEnd0/RotY                   = 0 deg
d:Ge/SilverLeftEnd0/RotZ                   = 0 deg
d:Ge/SilverLeftEnd0/RMin1                  = 0 mm
d:Ge/SilverLeftEnd0/RMax1                  = 0.25 mm
d:Ge/SilverLeftEnd0/RMin2                  = 0 mm
d:Ge/SilverLeftEnd0/RMax2                  = 0.175 mm
d:Ge/SilverLeftEnd0/HL                     = 0.0375 mm
d:Ge/SilverLeftEnd0/SPhi                   = 0 deg
d:Ge/SilverLeftEnd0/DPhi                   = 360 deg
s:Ge/SilverLeftEnd0/Color                  = "grey"
s:Ge/SilverLeftEnd0/DrawingStyle           = "FullWireFrame"
b:Ge/SilverLeftEnd0/IsParallel             = "T"
s:Ge/SilverLeftEnd0/ParallelWorldName      = "ActiveSourceWorld"

#=================
#Silver right end
#=================

s:Ge/SilverRightEnd0/Type                   = "G4Cons"
s:Ge/SilverRightEnd0/Parent                 = "RadioactiveRightEnd0"
s:Ge/SilverRightEnd0/Material               = "G4_Ag"
d:Ge/SilverRightEnd0/TransX                 = 0 mm
d:Ge/SilverRightEnd0/TransY                 = 0 mm
d:Ge/SilverRightEnd0/TransZ                 = -0.000875 mm
d:Ge/SilverRightEnd0/RotX                   = 0 deg
d:Ge/SilverRightEnd0/RotY                   = 0 deg
d:Ge/SilverRightEnd0/RotZ                   = 0 deg
d:Ge/SilverRightEnd0/RMin1                  = 0 mm
d:Ge/SilverRightEnd0/RMax1                  = 0.25 mm
d:Ge/SilverRightEnd0/RMin2                  = 0 mm
d:Ge/SilverRightEnd0/RMax2                  = 0.175 mm
d:Ge/SilverRightEnd0/HL                     = 0.0375 mm
d:Ge/SilverRightEnd0/SPhi                   = 0 deg
d:Ge/SilverRightEnd0/DPhi                   = 360 deg
s:Ge/SilverRightEnd0/Color                  = "grey"
s:Ge/SilverRightEnd0/DrawingStyle           = "FullWireFrame"
b:Ge/SilverRightEnd0/IsParallel             = "T"
s:Ge/SilverRightEnd0/ParallelWorldName      = "ActiveSourceWorld"

##### SHIELDING #####

s:Ge/ShieldingGeo0/Type              = "Group"
s:Ge/ShieldingGeo0/Parent            = "Seed0"
b:Ge/ShieldingGeo0/IsParallel        = "True"
s:Ge/ShieldingGeo0/ParallelWorldName = "ShieldingWorld"


#=====================
#Cylinder of Titanium
#=====================

s:Ge/TitaniumCylinder0/Type         = "TsCylinder"
s:Ge/TitaniumCylinder0/Parent       = "ShieldingGeo0"
s:Ge/TitaniumCylinder0/Material     = "Titanium"
d:Ge/TitaniumCylinder0/RMin         = 0.33 mm
d:Ge/TitaniumCylinder0/RMax         = 0.40 mm
d:Ge/TitaniumCylinder0/SPhi         = 180. deg
d:Ge/TitaniumCylinder0/DPhi         = 360. deg
d:Ge/TitaniumCylinder0/HL           = 1.875 mm
d:Ge/TitaniumCylinder0/TransX       = 0. mm
d:Ge/TitaniumCylinder0/TransY       = 0. mm
d:Ge/TitaniumCylinder0/TransZ       = 0. mm
d:Ge/TitaniumCylinder0/RotX         = 0. deg
d:Ge/TitaniumCylinder0/RotY         = 0. deg
d:Ge/TitaniumCylinder0/RotZ         = 0. deg
s:Ge/TitaniumCylinder0/Color        = "blue"
s:Ge/TitaniumCylinder0/DrawingStyle = "FullWireFrame"
b:Ge/TitaniumCylinder0/IsParallel   = "T"
s:Ge/TitaniumCylinder0/ParallelWorldName = "ShieldingWorld"

#===============================
#Left half-sphere of Titanium 
#===============================

s:Ge/TitaniumLeftCap0/Type         = "TsSphere"
s:Ge/TitaniumLeftCap0/Parent       = "ShieldingGeo0"
s:Ge/TitaniumLeftCap0/Material     = "Titanium"
d:Ge/TitaniumLeftCap0/RMin         = 0. mm
d:Ge/TitaniumLeftCap0/RMax         = 0.4 mm
d:Ge/TitaniumLeftCap0/SPhi         = 0. deg
d:Ge/TitaniumLeftCap0/DPhi         = 360. deg
d:Ge/TitaniumLeftCap0/STheta       = 0. deg
d:Ge/TitaniumLeftCap0/DTheta       = 90. deg
d:Ge/TitaniumLeftCap0/TransX       = 0. mm
d:Ge/TitaniumLeftCap0/TransY       = 0. mm
d:Ge/TitaniumLeftCap0/TransZ       = 1.875 mm
d:Ge/TitaniumLeftCap0/RotX         = 0. deg
d:Ge/TitaniumLeftCap0/RotY         = 0. deg
d:Ge/TitaniumLeftCap0/RotZ         = 0. deg
s:Ge/TitaniumLeftCap0/DrawingStyle = "FullWireFrame"
s:Ge/TitaniumLeftCap0/Color        = "blue"
b:Ge/TitaniumLeftCap0/IsParallel   = "T"
s:Ge/TitaniumLeftCap0/ParallelWorldName = "ShieldingWorld"

#================================
#Right half-sphere of titanium
#================================

s:Ge/TitaniumRightCap0/Type         = "TsSphere"
s:Ge/TitaniumRightCap0/Parent       = "ShieldingGeo0"
s:Ge/TitaniumRightCap0/Material     = "Titanium"
d:Ge/TitaniumRightCap0/RMin         = 0. mm
d:Ge/TitaniumRightCap0/RMax         = 0.4 mm
d:Ge/TitaniumRightCap0/SPhi         = 0. deg
d:Ge/TitaniumRightCap0/DPhi         = 360. deg
d:Ge/TitaniumRightCap0/STheta       = 0. deg
d:Ge/TitaniumRightCap0/DTheta       = 90. deg
d:Ge/TitaniumRightCap0/TransX       = 0. mm
d:Ge/TitaniumRightCap0/TransY       = 0. mm
d:Ge/TitaniumRightCap0/TransZ       = -1.875 mm
d:Ge/TitaniumRightCap0/RotX         = 180. deg
d:Ge/TitaniumRightCap0/RotY         = 0. deg
d:Ge/TitaniumRightCap0/RotZ         = 0. deg
s:Ge/TitaniumRightCap0/DrawingStyle = "FullWireFrame"
s:Ge/TitaniumRightCap0/Color        = "blue"
b:Ge/TitaniumRightCap0/IsParallel   = "T"
s:Ge/TitaniumRightCap0/ParallelWorldName = "ShieldingWorld"

#====================
#Dry Air cylinder
#====================

s:Ge/DryAirCylinder0/Type         = "TsCylinder"
s:Ge/DryAirCylinder0/Parent       = "ShieldingGeo0"
s:Ge/DryAirCylinder0/Material     = "G4_AIR"
d:Ge/DryAirCylinder0/RMin         = 0. mm
d:Ge/DryAirCylinder0/RMax         = 0.33 mm
d:Ge/DryAirCylinder0/SPhi         = 0. deg
d:Ge/DryAirCylinder0/DPhi         = 360. deg
d:Ge/DryAirCylinder0/HL           = 1.875 mm
d:Ge/DryAirCylinder0/TransX       = 0. mm
d:Ge/DryAirCylinder0/TransY       = 0. mm
d:Ge/DryAirCylinder0/TransZ       = 0. mm
d:Ge/DryAirCylinder0/RotX         = 0. deg
d:Ge/DryAirCylinder0/RotY         = 0. deg
d:Ge/DryAirCylinder0/RotZ         = 0. deg
s:Ge/DryAirCylinder0/DrawingStyle = "FullWireFrame"
s:Ge/DryAirCylinder0/Color        = "white"
b:Ge/DryAirCylinder0/IsParallel   = "T"
s:Ge/DryAirCylinder0/ParallelWorldName = "ShieldingWorld"



